/*    */ package scripting.map;
/*    */ 
/*    */ import client.MapleClient;
/*    */ import javax.script.Invocable;
/*    */ import javax.script.ScriptEngine;
/*    */ import org.apache.logging.log4j.LogManager;
/*    */ import org.apache.logging.log4j.Logger;
/*    */ import scripting.item.ItemScriptManager;
/*    */ 
/*    */ 
/*    */ public class NodeScriptManager
/*    */   extends ItemScriptManager
/*    */ {
/* 14 */   private static final Logger log = LogManager.getLogger();
/* 15 */   private static final NodeScriptManager instance = new NodeScriptManager();
/*    */   
/*    */   public static final NodeScriptManager getInstance() {
/* 18 */     return instance;
/*    */   }
/*    */   
/*    */   public void getNodeScript(MapleClient c, String scriptName, int duration, int mobOid) {
/*    */     try {
/* 23 */       Invocable invocable = getInvocable("map/Nodes/" + scriptName + ".js", null);
/* 24 */       if (invocable == null) {
/* 25 */         if (c.getPlayer().isAdmin()) {
/* 26 */           System.err.println("未找到 Nodes 文件中的 " + scriptName + ".js 文件");
/* 27 */           c.getPlayer().dropMessage(5, "未找到 Nodes 文件中的 " + scriptName + ".js 文件.");
/*    */         } 
/* 29 */         log.error("未找到 Nodes 文件中的 " + scriptName + ".js 文件.");
/*    */         return;
/*    */       } 
/* 32 */       ScriptEngine scriptEngine = (ScriptEngine)invocable;
/* 33 */       NodeScriptMethods a2 = new NodeScriptMethods(c, scriptName);
/* 34 */       scriptEngine.put("nm", a2);
/* 35 */       invocable.invokeFunction("act", new Object[] { Integer.valueOf(mobOid), Integer.valueOf(duration) });
/* 36 */     } catch (NoSuchMethodException|javax.script.ScriptException exception) {
/* 37 */       System.err.println("执行Nodes文件出错  Nodes名称: " + scriptName + " 错误信息: " + exception);
/* 38 */       log.error("日志/脚本/Nodes脚本异常.log", "执行Nodes文件出错  Nodes名称: " + scriptName + " 错误信息: ", exception);
/*    */     } 
/*    */   }
/*    */ }


/* Location:              C:\PGX\Server.jar!\scripting\map\NodeScriptManager.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */